package com.cellngine.server.model;

import com.cellngine.server.ServerClientSocket;

public class Session extends BaseObject
{
	private String				username	= null;
	private Client				client		= null;
	private String				address;
	private ServerClientSocket	socket;
	private Thread				socketThread;
	
	public Session(final ServerClientSocket socket)
	{
		this.socket = socket;
		this.address = socket.getIPAddress();
		
		this.socketThread = new Thread(this.socket);
		this.socketThread.start();
	}
	
	public void terminateConnection()
	{
		if (this.socket != null && this.socket.connectionAlive())
		{
			this.socket.close();
		}
	}
	
	public String getAddress()
	{
		return this.address;
	}
	
	public String getUsername()
	{
		return this.username;
	}
	
	public void setUsername(final String username)
	{
		this.username = username;
	}
}